package com.util;

public class DataBaseUtil {

	public static String pageSql(String tableName, int start, int end, String databaseType, String orderby){
		String sql = "" ;
		if("sqlserver".equals(databaseType)) {
			sql = "select a.* from (" +
				" select row_number() over(order by " + orderby + " desc) as rowNum, * " +
				" from " + tableName +
				" ) a " +
				" where a.rowNum> " + start + " and a.rowNum <=" + end + " " ;
		}else if("mysql".equals(databaseType)) {
			sql = "select * from " + tableName + " LIMIT " + start + ", " + end + "" ;
		}
		return sql ;
	}
}
